package com.example.mydemoapplication.presenter;

import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import com.example.mydemoapplication.CountDownTimeHandler;
import com.example.mydemoapplication.view.IDownloadView;

/**
 * Created by kaede on 2015/5/18.
 */
public class DownloadPresenterCompl implements IDownloadPresenter {
	IDownloadView iDownloadView;
	Handler    handler;
	CountDownTimeHandler countDownTimeHandler;

	public DownloadPresenterCompl(IDownloadView iDownloadView) {
		this.iDownloadView = iDownloadView;
		handler = new Handler(Looper.getMainLooper());
		countDownTimeHandler = new CountDownTimeHandler(iDownloadView);
	}

	@Override
	public void startDownload() {
		Message message = Message.obtain();
		message.what = 1004;
		message.arg1 = 0;
		countDownTimeHandler.sendMessageDelayed(message,1000);
	}

	@Override
	public void stopDownload() {
		Message message = Message.obtain();
		message.what = 1005;
		countDownTimeHandler.sendMessage(message);


	}


}
